<?php
include_once("include/public.php");
$id = GETD('id');
$page = GETD('page');
if($page>0)
{
	$page--;	
}
$perpage = 20;
if($id!=0)
{
	$one = $db->get_one("select active,title,content from wnews where id={$id}",MYSQL_ASSOC);
	$smarty->assign("one",$one);
	$outFile = "news_detail.html";	
}
else{
	$total = sizeof($db->query_row("select id from wnews",MYSQL_ASSOC));
	$news = $db->query_row("select id,title,active from wnews order by active desc,id desc limit ".$page*$perpage.",$perpage",MYSQL_ASSOC);
	$p = new WPagenavE();
	$p->file	= $_SERVER["SCRIPT_NAME"];
	$p->pvar	= "p";	//设置页面传递的参数，默认为p	  
	$p->set($perpage,$total);
	$smarty->assign("news",$news);
	$smarty->assign("p",$p->output);
	$outFile = "news.html";
}
$pageTitle = "最新公告-";
$smarty->assign("pageTitle",$pageTitle);
$smarty->display($outFile);
?>